In [1]:
# import Library's
In [2]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.graph_objs as go
import plotly.offline as py
import seaborn as sns
import matplotlib.ticker as mtick
plt.style.use('fivethirtyeight')
# https://matplotlib.org/stable/gallery/style_sheets/fivethirtyeight.html
# https://towardsdatascience.com/a-beginners-guide-to-plotting-fivethrityeight-like-visualizations-5b63d3f3ddd0
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import  ExtraTreesRegressor
from sklearn.ensemble import  RandomForestRegressor
from sklearn.model_selection import train_test_split
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
import os
In [3]:
# Import dataset
In [5]:
data = pd.read_csv('G://python//Tablue//zomato.csv')
display(data)
url address name online_order book_table rate votes phone location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
0 https://www.zomato.com/bangalore/jalsa-banasha... 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 080 42297555\r\n+91 9743772233 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 https://www.zomato.com/bangalore/spice-elephan... 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 080 41714161 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 https://www.zomato.com/SanchurroBangalore?cont... 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 +91 9663487993 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 https://www.zomato.com/bangalore/addhuri-udupi... 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 +91 9620009302 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 https://www.zomato.com/bangalore/grand-village... 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 +91 8026612447\r\n+91 9901210005 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51712 https://www.zomato.com/bangalore/best-brews-fo... Four Points by Sheraton Bengaluru, 43/3, White... Best Brews - Four Points by Sheraton Bengaluru... No No 3.6 /5 27 080 40301477 Whitefield Bar NaN Continental 1,500 [('Rated 5.0', "RATED\n Food and service are ... [] Pubs and bars Whitefield
51713 https://www.zomato.com/bangalore/vinod-bar-and... Number 10, Garudachar Palya, Mahadevapura, Whi... Vinod Bar And Restaurant No No NaN 0 +91 8197675843 Whitefield Bar NaN Finger Food 600 [] [] Pubs and bars Whitefield
51714 https://www.zomato.com/bangalore/plunge-sherat... Sheraton Grand Bengaluru Whitefield Hotel & Co... Plunge - Sheraton Grand Bengaluru Whitefield H... No No NaN 0 NaN Whitefield Bar NaN Finger Food 2,000 [] [] Pubs and bars Whitefield
51715 https://www.zomato.com/bangalore/chime-sherato... Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 080 49652769 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield
51716 https://www.zomato.com/bangalore/the-nest-the-... ITPL Main Road, KIADB Export Promotion Industr... The Nest - The Den Bengaluru No No 3.4 /5 13 +91 8071117272 ITPL Main Road, Whitefield Bar, Casual Dining NaN Finger Food, North Indian, Continental 1,500 [('Rated 5.0', 'RATED\n Great ambience , look... [] Pubs and bars Whitefield

51717 rows × 17 columns

In [6]:
# Check data shape
In [7]:
display(data.shape)
(51717, 17)
In [8]:
print (data.dtypes )
url                            object
address                        object
name                           object
online_order                   object
book_table                     object
rate                           object
votes                           int64
phone                          object
location                       object
rest_type                      object
dish_liked                     object
cuisines                       object
approx_cost(for two people)    object
reviews_list                   object
menu_item                      object
listed_in(type)                object
listed_in(city)                object
dtype: object
In [9]:
# Check for Null Values
In [10]:
print (data.isna().sum() )
url                                0
address                            0
name                               0
online_order                       0
book_table                         0
rate                            7775
votes                              0
phone                           1208
location                          21
rest_type                        227
dish_liked                     28078
cuisines                          45
approx_cost(for two people)      346
reviews_list                       0
menu_item                          0
listed_in(type)                    0
listed_in(city)                    0
dtype: int64
In [11]:
#Deleting Unnecessary Columns
#Dropping the column like "phone" and "url" then create data set "df"
In [12]:
df=data.drop(['url','phone'],axis=1)
In [13]:
# Check for Duplicate Records 
In [14]:
df.duplicated().sum()
Out[14]:
43
In [15]:
# Display duplicate Records 
In [16]:
df[df.duplicated()]
Out[16]:
address name online_order book_table rate votes location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
596 572, 30th Main, 3rd Stage, Banashankari, Banga... My Tea House Yes Yes NEW 0 Banashankari Casual Dining NaN Continental, Asian, North Indian, Tea 500 [('Rated 4.0', "RATED\n So apparently I visit... ['MTH Signature Soup', 'Minestrone Veg', 'Broc... Dine-out Banashankari
7599 17, Thubarahalli Village, Hobli, Varthur Main ... Nawab Di Biryani Yes No NEW 0 Whitefield Takeaway, Delivery NaN Biryani, Mughlai 400 [('Rated 4.0', 'RATED\n Ordered paneer tikka ... ['Paneer Tikka Biryani', 'Veg Lucknowi Biryani... Delivery Brookefield
9464 744, 13th Main, 7th Cross, BTM 2nd Stage, BTM,... Vyanjan Yes No 3.9/5 201 BTM Quick Bites Poha, Jalebi, Paratha, Bhindi Masala, Kachori,... North Indian, Street Food 300 [('Rated 3.0', "RATED\n Nice place, it's for ... ['Jeera Rice', 'Khichdi', 'Plain Tawa Roti', '... Delivery BTM
9466 607, First Floor, 80 Feet Road, 6th Block, Kor... Carrots Yes Yes 4.1/5 600 Koramangala 6th Block Casual Dining Pizza, Pasta, Salads, Masala Chai, Soya Butter... Italian, North Indian, Healthy Food, Desserts 1,100 [('Rated 5.0', "RATED\n It's the first vegan ... [] Delivery BTM
9467 Building 58, New 3, A Main Road Marenahalli, J... Eatsomnia Yes No NEW 0 JP Nagar Delivery NaN North Indian, South Indian, Chinese, Continental 500 [('Rated 1.0', "RATED\n The worst food I ate ... [] Delivery BTM
9468 6th Cross Road, Koramangala 6th Block, Bangalore Rolls & Co Yes No 3.9/5 213 Koramangala 6th Block Quick Bites Rolls, Chicken Wings, Shawarma, Chicken Tikka ... Burger, Beverages, Rolls 400 [('Rated 2.0', 'RATED\n Order : Peri Peri Fri... [] Delivery BTM
9469 10, Opposite Forum Mall, Taverekere, Suddagunt... Fogg No Yes NEW 0 BTM Quick Bites NaN Fast Food, Chinese 200 [('Rated 5.0', 'RATED\n Seafood soup - A Thai... [] Delivery BTM
9470 Koramangala 1st Block, Bangalore The Paratha Stories Yes No 3.3/5 36 Koramangala 1st Block Delivery NaN North Indian 400 [('Rated 3.0', 'RATED\n There is enough scope... [] Delivery BTM
9471 29, 7th Cross Road, Bhavani Nagar, Suddagunte ... Mycakeshop Yes No NaN 0 BTM Bakery NaN Bakery, Desserts 300 [('Rated 5.0', 'RATED\n I loved cake nice tru... ['Red Velvet Cake', 'Truffle Chocolate Cake', ... Delivery BTM
9549 51, 5th Main, 60 Feet Road, BNG Homestay Build... Bisimillah Biriyani No No 3.5/5 11 BTM Quick Bites NaN Biryani, Fast Food 300 [('Rated 4.0', 'RATED\n Very delicious food @... [] Delivery BTM
9638 51, 5th Main, 60 Feet Road, BNG Homestay Build... Bisimillah Biriyani's & Kebab's No No 3.3/5 6 BTM Quick Bites NaN Biryani, Fast Food 300 [] [] Delivery BTM
12287 Q Court, 3rd Floor, Garuda Mall, Magarth Road,... China South Yes No NaN 0 Brigade Road Casual Dining NaN Chinese, Tibetan 600 [('Rated 4.0', 'RATED\n Been at this place tw... ['Egg Fried Rice', 'Chicken American Chopsuey'... Delivery Church Street
12288 24/48, M Road Benson Town Frazer Town, Bangalore Chination No No NaN 0 Frazer Town Delivery NaN Chinese 600 [] [] Delivery Church Street
12289 Garuda Mall, 3rd Floor, 15 Magrath Road, Craig... Desi Streat Yes No NaN 0 Brigade Road Food Court NaN South Indian, Street Food 400 [('Rated 1.0', "RATED\n Try asking for combo.... ['Sambar Idli', 'Moong Chilla with Paneer Bhur... Delivery Church Street
12290 KH Marigowda Road, Near Hopcoms Complex, Shant... Durga Sagar Yes No 3.3/5 8 Shanti Nagar Quick Bites NaN South Indian 150 [('Rated 4.0', 'RATED\n Ordered Anna sambar..... ['4 Pakoda', 'Green Salad', 'Cucumber Salad', ... Delivery Church Street
12291 34/2, Meaner Avenue Tank Road, Near Ulsoor Lak... Happy Fillings Yes No 3.4/5 8 Ulsoor Quick Bites NaN Chinese 300 [('Rated 5.0', 'RATED\n A Good take away Chin... [] Delivery Church Street
12292 25, Gover Road, Cox Town, Frazer Town, Bangalore Marathi Biriyani House Yes No 3.3/5 6 Frazer Town Quick Bites NaN South Indian, Biryani 300 [('Rated 4.0', 'RATED\n Happened to just come... [] Delivery Church Street
12294 19, Saunder Road, Opposite Seventh Day Hospita... Kareem's Yes No 3.6/5 32 Frazer Town Quick Bites NaN North Indian, Mughlai 700 [('Rated 4.0', 'RATED\n Seen this restaurant ... ['Kareen Special Murgh Tandoori', 'Gosht Seekh... Delivery Church Street
12296 307, Thimmaiah Rd, Govinda Chetty Colony, Shiv... Aubree Yes No NaN 0 Shivajinagar Cafe, Bakery NaN Cafe, Bakery 400 [('Rated 5.0', "RATED\n Aubree has become a v... ['Strawberry Macarons [Box of 5]', 'Lite Touch... Delivery Church Street
12303 1, High Street, Cooke Town, Frazer Town, Banga... Mudaliar's Kitchen Yes No NaN 0 Frazer Town Delivery NaN South Indian 500 [] [] Delivery Church Street
12314 19/1, Queen's Road Cross, Munniswamy Road, Nea... Ta'aam Yes No 4.1/5 402 Cunningham Road Casual Dining Laham Mandi, Mutton Chops, Biryani, Mutton Sou... North Indian, Mughlai, Arabian, Chinese 750 [('Rated 4.0', "RATED\n For all gluttons out ... [] Delivery Church Street
12322 Alpine Annexed Apartment, Near ICICI Bank, Sha... Promac Foods Yes No NEW 0 Shanti Nagar Takeaway, Delivery NaN North Indian, South Indian 250 [] [] Delivery Church Street
12347 Plot 62, Nanjappa Layout, Adugodi Main Road, A... Ascharya Hotel Yes No 3.4/5 11 Koramangala 5th Block Quick Bites NaN Mangalorean, South Indian 300 [('Rated 3.0', 'RATED\n I would say that thei... [] Delivery Church Street
13442 Opposite Velankani Gate number 2, Doddathoguru... Lassi Adda Yes No 4.0/5 65 Electronic City Beverage Shop Sweet Lassi, Corn Sandwich Beverages, Sandwich, Fast Food 200 [('Rated 4.0', 'RATED\n My favourite go to pl... [] Delivery Electronic City
13467 65, TS Arcade, Next To Michelin Tyre Centre, C... Sitaar Yes Yes 3.8/5 88 Electronic City Casual Dining NaN North Indian, Chinese 800 [('Rated 5.0', "RATED\n Really good food and ... [] Delivery Electronic City
17655 Opposite Sri Subramanya Swamy Temple, Next to ... New Taj Yes No 3.3/5 110 Ulsoor Quick Bites NaN North Indian, Chinese 300 [('Rated 2.0', "RATED\n It's my nature to try... [] Delivery Indiranagar
20236 746, 7th cross, 13th Main, BTM, Bangalore Funky Punjab Yes No 3.8/5 125 BTM Quick Bites Roti, Dal Makhani, Lassi, Panneer Butter Masal... North Indian, Chinese 400 [('Rated 3.0', "RATED\n Wasn't as great as we... [] Delivery Jayanagar
20836 36, Jaya Bheema Nagar, Layout 1, BTM, Bangalore La Passion Cafe Yes No NaN 0 BTM Cafe NaN Cafe 500 [] [] Delivery Jayanagar
20851 3,11th Cross, Maruthi Nagar, 1st Stage, BTM, B... Royal's Biryani Yes No NaN 0 BTM Quick Bites NaN Biryani 300 [('Rated 4.0', 'RATED\n An amazing biryani pl... [] Delivery Jayanagar
20852 14, Tank Shore Road, Kuvempu Nagar, Stage 2, B... Tandoor Nation Yes No 3.0/5 39 BTM Quick Bites NaN North Indian, Chinese 400 [('Rated 3.0', 'RATED\n Calm, cozy and open s... ['Chicken Curry', 'Chicken Pepper Dry', 'Chick... Delivery Jayanagar
20853 242, 7th Main, Mico Layout, BTM, Bangalore Indian Kitchen Eateries-IKE Yes No 3.4/5 8 BTM Quick Bites NaN Fast Food 150 [('Rated 5.0', 'RATED\n One of the best snack... [] Delivery Jayanagar
26434 10, Babasabarapalya, Near Panchamukhi Ganesha ... The Bridge Walk Cafe No No 3.8 /5 74 Kengeri Cafe NaN Cafe, Continental 500 [('Rated 3.0', 'RATED\n This cafe opened up f... [] Dine-out Kammanahalli
28139 1086/A, Twin Tulips, 18th Cross, 14th Main Roa... Wedding Biryani No No NEW 0 HSR Quick Bites NaN Biryani, Kebab 600 [] [] Delivery Koramangala 4th Block
37692 Ashraya Hotel, 149, Infantry Road, Bangalore The Oriental Spice - Ashraya Hotel Yes No 3.9 /5 158 Infantry Road Casual Dining Noodles, Lunch Buffet, Fish, Manchurian, Salad... Chinese, Thai, Indonesian 1,300 [('Rated 4.0', 'RATED\n Had been there for a ... ['Sour Pepper Soup', 'Chicken Cantonese Style'... Buffet Lavelle Road
38109 99, 3rd Main Road, Hanumanthnagar, Banashankar... Sai Super Sandwich Yes No NEW 0 Banashankari Quick Bites NaN Sandwich, Beverages 200 [] [] Delivery Lavelle Road
38585 Level 2, The Collection, UB City, Vithal Mally... Rasovara Yes Yes 4.3 /5 772 Lavelle Road Casual Dining Thali, Aamras, Malpua, Dal Bati, Lassi, Plain ... Rajasthani, North Indian 1,400 [('Rated 4.0', 'RATED\n The problem here is a... [] Dine-out Lavelle Road
41404 168/4, Ward 57, Abbaiah Reddy, Layout Main Roa... Andhra Express Yes No 3.7 /5 19 CV Raman Nagar Takeaway, Delivery NaN Andhra, Biryani, North Indian, Beverages 300 [('Rated 5.0', 'RATED\n Amazing take away / h... [] Delivery Marathahalli
42312 12/1, Swami Vivekananda Road, Jayaraj Nagar, S... Shahi Family Restaurant Yes No 3.2 /5 88 Ulsoor Quick Bites NaN North Indian, Chinese, South Indian 350 [('Rated 3.0', 'RATED\n Tried chicken biriyan... ['Veg Chinese Combo', 'Non Veg Chinese Combo',... Delivery MG Road
42343 Money Chambers Double Road, Shanti Nagar, Bang... Red Onion Yes Yes 4.2 /5 570 Shanti Nagar Casual Dining Fish, Dumplings, Biryani, Paneer Tikka Masala,... Chinese, North Indian, Biryani, Kebab 1,200 [('Rated 5.0', 'RATED\n Was wandering around ... ['Paneer Makhani', 'Hyderabadi Biryani', 'Spec... Delivery MG Road
43354 36, Vittal Mallya Road, Lavelle Road, Bangalore Bootlegger No No 4.1 /5 1545 Lavelle Road Pub Beer, Cocktails, Beef Steak, Beef Chilli, Nach... Continental, Steak 1,200 [('Rated 2.0', 'RATED\n Bootlegger is undoubt... [] Dine-out MG Road
43369 Chancery Pavilion, 135, Residency Road, Bangalore Ithaca - The Chancery Pavilion No Yes 3.9 /5 312 Residency Road Fine Dining Salads, Sunday Brunch, Cocktails, Watermelon J... North Indian, Italian, European, Continental 2,000 [('Rated 3.0', 'RATED\n The food was good\nTh... [] Dine-out MG Road
46118 1200, 100 Feet Road, HAL 2nd Stage, Indiranaga... Boozers Bar & Kitchen No No 4.3 /5 700 Indiranagar Bar, Casual Dining Beer, Cocktails, Chicken Burger, Pasta, Tandoo... Continental, Burger, Italian, Pizza, North Ind... NaN [('Rated 2.0', 'RATED\n A relatively new. I g... [] Pubs and bars Old Airport Road
50904 17, Thubarahalli Village, Hobli, Varthur Main ... Nawab Di Biryani Yes No NEW 0 Whitefield Takeaway, Delivery NaN Biryani, Mughlai 400 [('Rated 3.0', 'RATED\n Biriyani had ordered ... [] Delivery Whitefield
In [17]:
# Drop Duplicate Records 
In [18]:
df.drop_duplicates(inplace=True)
In [19]:
display(df.duplicated().sum())
0
In [20]:
# Display Data Frame
In [21]:
display(df)
address name online_order book_table rate votes location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51712 Four Points by Sheraton Bengaluru, 43/3, White... Best Brews - Four Points by Sheraton Bengaluru... No No 3.6 /5 27 Whitefield Bar NaN Continental 1,500 [('Rated 5.0', "RATED\n Food and service are ... [] Pubs and bars Whitefield
51713 Number 10, Garudachar Palya, Mahadevapura, Whi... Vinod Bar And Restaurant No No NaN 0 Whitefield Bar NaN Finger Food 600 [] [] Pubs and bars Whitefield
51714 Sheraton Grand Bengaluru Whitefield Hotel & Co... Plunge - Sheraton Grand Bengaluru Whitefield H... No No NaN 0 Whitefield Bar NaN Finger Food 2,000 [] [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield
51716 ITPL Main Road, KIADB Export Promotion Industr... The Nest - The Den Bengaluru No No 3.4 /5 13 ITPL Main Road, Whitefield Bar, Casual Dining NaN Finger Food, North Indian, Continental 1,500 [('Rated 5.0', 'RATED\n Great ambience , look... [] Pubs and bars Whitefield

51674 rows × 15 columns

In [22]:
# display(df)
In [23]:
df.dropna(how='any',inplace=True)
In [24]:
display (df.isnull().sum())
address                        0
name                           0
online_order                   0
book_table                     0
rate                           0
votes                          0
location                       0
rest_type                      0
dish_liked                     0
cuisines                       0
approx_cost(for two people)    0
reviews_list                   0
menu_item                      0
listed_in(type)                0
listed_in(city)                0
dtype: int64
In [25]:
# Display Data Frame
In [26]:
display(df)
address name online_order book_table rate votes location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51705 2nd Floor, Iona, Virginia Mall, Whitefield Mai... Izakaya Gastro Pub Yes Yes 3.8 /5 128 Whitefield Bar, Casual Dining Beer, Chicken Guntur, Paneer Tikka, Fish, Nood... North Indian, Continental, Mediterranean 1,200 [('Rated 3.0', "RATED\n Nice place to hangout... [] Pubs and bars Whitefield
51707 Bengaluru Marriott Hotel, 75, 8th Road, EPIP A... M Bar - Bengaluru Marriott Hotel Whitefield No No 3.9 /5 77 Whitefield Fine Dining, Bar Rooftop Ambience Finger Food 2,000 [('Rated 4.0', 'RATED\n Went there post dinne... [] Pubs and bars Whitefield
51708 Keys Hotel, 6, 1st Phase Industrial Area, Near... Keys Cafe - Keys Hotel No No 2.8 /5 161 Whitefield Casual Dining, Bar Salads, Coffee, Breakfast Buffet, Halwa, Chick... Chinese, Continental, North Indian 1,200 [('Rated 3.0', 'RATED\n Place is good not tha... [] Pubs and bars Whitefield
51711 139/C1, Next To GR Tech Park, Pattandur Agraha... Bhagini No No 2.5 /5 81 Whitefield Casual Dining, Bar Biryani, Andhra Meal Andhra, South Indian, Chinese, North Indian 800 [('Rated 4.0', 'RATED\n A fine place to chill... [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield

23395 rows × 15 columns

In [27]:
# Display Column Names
In [28]:
display(df.columns)
Index(['address', 'name', 'online_order', 'book_table', 'rate', 'votes',
       'location', 'rest_type', 'dish_liked', 'cuisines',
       'approx_cost(for two people)', 'reviews_list', 'menu_item',
       'listed_in(type)', 'listed_in(city)'],
      dtype='object')
In [29]:
# display(df.columns)
In [30]:
df = df.rename(columns={'approx_cost(for two people)':'cost','listed_in(type)':'type', 'listed_in(city)':'city'})
display (df.columns)
Index(['address', 'name', 'online_order', 'book_table', 'rate', 'votes',
       'location', 'rest_type', 'dish_liked', 'cuisines', 'cost',
       'reviews_list', 'menu_item', 'type', 'city'],
      dtype='object')
In [31]:
# Display Data Frame
In [32]:
display (df)
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51705 2nd Floor, Iona, Virginia Mall, Whitefield Mai... Izakaya Gastro Pub Yes Yes 3.8 /5 128 Whitefield Bar, Casual Dining Beer, Chicken Guntur, Paneer Tikka, Fish, Nood... North Indian, Continental, Mediterranean 1,200 [('Rated 3.0', "RATED\n Nice place to hangout... [] Pubs and bars Whitefield
51707 Bengaluru Marriott Hotel, 75, 8th Road, EPIP A... M Bar - Bengaluru Marriott Hotel Whitefield No No 3.9 /5 77 Whitefield Fine Dining, Bar Rooftop Ambience Finger Food 2,000 [('Rated 4.0', 'RATED\n Went there post dinne... [] Pubs and bars Whitefield
51708 Keys Hotel, 6, 1st Phase Industrial Area, Near... Keys Cafe - Keys Hotel No No 2.8 /5 161 Whitefield Casual Dining, Bar Salads, Coffee, Breakfast Buffet, Halwa, Chick... Chinese, Continental, North Indian 1,200 [('Rated 3.0', 'RATED\n Place is good not tha... [] Pubs and bars Whitefield
51711 139/C1, Next To GR Tech Park, Pattandur Agraha... Bhagini No No 2.5 /5 81 Whitefield Casual Dining, Bar Biryani, Andhra Meal Andhra, South Indian, Chinese, North Indian 800 [('Rated 4.0', 'RATED\n A fine place to chill... [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield

23395 rows × 15 columns

In [33]:
# Get Unique Values from Cost column 
In [34]:
display (df['cost']. unique())
array(['800', '300', '600', '700', '550', '500', '450', '650', '400',
       '750', '200', '850', '1,200', '150', '350', '250', '1,500',
       '1,300', '1,000', '100', '900', '1,100', '1,600', '950', '230',
       '1,700', '1,400', '1,350', '2,200', '2,000', '1,800', '1,900',
       '180', '330', '2,500', '2,100', '3,000', '2,800', '3,400', '40',
       '1,250', '3,500', '4,000', '2,400', '1,450', '3,200', '6,000',
       '1,050', '4,100', '2,300', '120', '2,600', '5,000', '3,700',
       '1,650', '2,700', '4,500'], dtype=object)
In [37]:
# Remove the comma separator in the number. 
# Change the data type from string to float
### #Using lambda function to replace ',' with nothing in the cost
In [38]:
df['cost'] = df['cost'].apply(lambda x: x.replace(',','')) 
df['cost'] = df['cost'].astype(float)
In [39]:
# Display Unique Values from Cost column
In [40]:
display (df['cost']. unique())
array([ 800.,  300.,  600.,  700.,  550.,  500.,  450.,  650.,  400.,
        750.,  200.,  850., 1200.,  150.,  350.,  250., 1500., 1300.,
       1000.,  100.,  900., 1100., 1600.,  950.,  230., 1700., 1400.,
       1350., 2200., 2000., 1800., 1900.,  180.,  330., 2500., 2100.,
       3000., 2800., 3400.,   40., 1250., 3500., 4000., 2400., 1450.,
       3200., 6000., 1050., 4100., 2300.,  120., 2600., 5000., 3700.,
       1650., 2700., 4500.])
In [41]:
# Display Data Type of all columns 
In [42]:
display (df.dtypes)
address          object
name             object
online_order     object
book_table       object
rate             object
votes             int64
location         object
rest_type        object
dish_liked       object
cuisines         object
cost            float64
reviews_list     object
menu_item        object
type             object
city             object
dtype: object
In [43]:
# Get Unique Values from Rate column 
In [44]:
df['rate'].unique()
Out[44]:
array(['4.1/5', '3.8/5', '3.7/5', '4.6/5', '4.0/5', '4.2/5', '3.9/5',
       '3.0/5', '3.6/5', '2.8/5', '4.4/5', '3.1/5', '4.3/5', '2.6/5',
       '3.3/5', '3.5/5', '3.8 /5', '3.2/5', '4.5/5', '2.5/5', '2.9/5',
       '3.4/5', '2.7/5', '4.7/5', 'NEW', '2.4/5', '2.2/5', '2.3/5',
       '4.8/5', '3.9 /5', '4.2 /5', '4.0 /5', '4.1 /5', '2.9 /5',
       '2.7 /5', '2.5 /5', '2.6 /5', '4.5 /5', '4.3 /5', '3.7 /5',
       '4.4 /5', '4.9/5', '2.1/5', '2.0/5', '1.8/5', '3.4 /5', '3.6 /5',
       '3.3 /5', '4.6 /5', '4.9 /5', '3.2 /5', '3.0 /5', '2.8 /5',
       '3.5 /5', '3.1 /5', '4.8 /5', '2.3 /5', '4.7 /5', '2.4 /5',
       '2.1 /5', '2.2 /5', '2.0 /5', '1.8 /5'], dtype=object)
In [45]:
# Number of records related to each unique value
In [47]:
display(df['rate'].value_counts().head(60))
3.9/5     1691
3.9 /5    1555
4.0/5     1475
4.0 /5    1427
4.1/5     1417
4.1 /5    1410
3.8/5     1332
3.8 /5    1151
4.2 /5    1122
4.2/5     1002
4.3 /5     909
3.7/5      875
3.7 /5     771
4.3/5      771
4.4 /5     623
4.4/5      519
3.6/5      447
3.6 /5     431
4.5 /5     404
3.5/5      260
4.5/5      244
3.5 /5     222
3.0/5      185
3.4 /5     185
2.9/5      175
4.6 /5     175
3.4/5      166
3.1/5      163
2.8 /5     163
2.8/5      158
NEW        147
3.1 /5     144
2.9 /5     138
3.2/5      137
3.3/5      127
4.6/5      125
3.2 /5     113
3.0 /5     106
2.7/5      105
3.3 /5      92
4.7 /5      86
2.7 /5      85
4.7/5       81
2.6/5       77
2.6 /5      61
4.8 /5      43
2.5 /5      32
2.4/5       30
4.9 /5      30
4.9/5       25
2.5/5       25
2.3/5       25
2.4 /5      24
4.8/5       23
2.3 /5      20
2.2/5       19
2.1 /5      13
2.1/5       11
2.2 /5       7
2.0 /5       7
Name: rate, dtype: int64
In [48]:
# Remove the records related to “New”
# There is one Unique value "NEW", get rid of all records (147 records) with value “New” in the rate column
In [50]:
df = df.loc[df.rate !='NEW'] 
display(df)
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800.0 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800.0 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300.0 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600.0 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51705 2nd Floor, Iona, Virginia Mall, Whitefield Mai... Izakaya Gastro Pub Yes Yes 3.8 /5 128 Whitefield Bar, Casual Dining Beer, Chicken Guntur, Paneer Tikka, Fish, Nood... North Indian, Continental, Mediterranean 1200.0 [('Rated 3.0', "RATED\n Nice place to hangout... [] Pubs and bars Whitefield
51707 Bengaluru Marriott Hotel, 75, 8th Road, EPIP A... M Bar - Bengaluru Marriott Hotel Whitefield No No 3.9 /5 77 Whitefield Fine Dining, Bar Rooftop Ambience Finger Food 2000.0 [('Rated 4.0', 'RATED\n Went there post dinne... [] Pubs and bars Whitefield
51708 Keys Hotel, 6, 1st Phase Industrial Area, Near... Keys Cafe - Keys Hotel No No 2.8 /5 161 Whitefield Casual Dining, Bar Salads, Coffee, Breakfast Buffet, Halwa, Chick... Chinese, Continental, North Indian 1200.0 [('Rated 3.0', 'RATED\n Place is good not tha... [] Pubs and bars Whitefield
51711 139/C1, Next To GR Tech Park, Pattandur Agraha... Bhagini No No 2.5 /5 81 Whitefield Casual Dining, Bar Biryani, Andhra Meal Andhra, South Indian, Chinese, North Indian 800.0 [('Rated 4.0', 'RATED\n A fine place to chill... [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2500.0 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield

23248 rows × 15 columns

In [51]:
# Display Unique Values (Rate Column) 
In [52]:
display (df['rate']. unique())
array(['4.1/5', '3.8/5', '3.7/5', '4.6/5', '4.0/5', '4.2/5', '3.9/5',
       '3.0/5', '3.6/5', '2.8/5', '4.4/5', '3.1/5', '4.3/5', '2.6/5',
       '3.3/5', '3.5/5', '3.8 /5', '3.2/5', '4.5/5', '2.5/5', '2.9/5',
       '3.4/5', '2.7/5', '4.7/5', '2.4/5', '2.2/5', '2.3/5', '4.8/5',
       '3.9 /5', '4.2 /5', '4.0 /5', '4.1 /5', '2.9 /5', '2.7 /5',
       '2.5 /5', '2.6 /5', '4.5 /5', '4.3 /5', '3.7 /5', '4.4 /5',
       '4.9/5', '2.1/5', '2.0/5', '1.8/5', '3.4 /5', '3.6 /5', '3.3 /5',
       '4.6 /5', '4.9 /5', '3.2 /5', '3.0 /5', '2.8 /5', '3.5 /5',
       '3.1 /5', '4.8 /5', '2.3 /5', '4.7 /5', '2.4 /5', '2.1 /5',
       '2.2 /5', '2.0 /5', '1.8 /5'], dtype=object)
In [53]:
# display (df['rate']. unique())
In [54]:
df['rate'] = df['rate'].apply(lambda x: x.replace('/5',''))
display (df['rate'].unique())
array(['4.1', '3.8', '3.7', '4.6', '4.0', '4.2', '3.9', '3.0', '3.6',
       '2.8', '4.4', '3.1', '4.3', '2.6', '3.3', '3.5', '3.8 ', '3.2',
       '4.5', '2.5', '2.9', '3.4', '2.7', '4.7', '2.4', '2.2', '2.3',
       '4.8', '3.9 ', '4.2 ', '4.0 ', '4.1 ', '2.9 ', '2.7 ', '2.5 ',
       '2.6 ', '4.5 ', '4.3 ', '3.7 ', '4.4 ', '4.9', '2.1', '2.0', '1.8',
       '3.4 ', '3.6 ', '3.3 ', '4.6 ', '4.9 ', '3.2 ', '3.0 ', '2.8 ',
       '3.5 ', '3.1 ', '4.8 ', '2.3 ', '4.7 ', '2.4 ', '2.1 ', '2.2 ',
       '2.0 ', '1.8 '], dtype=object)
In [55]:
# Visualizations
# Famous Restaurants 
In [56]:
# Restaurants with number of outlets 
In [57]:
df['name'].value_counts()
Out[57]:
Onesta                                    85
Empire Restaurant                         67
KFC                                       59
McDonald's                                57
Pizza Hut                                 56
                                          ..
Le Jardin By Bhagini                       1
Incanto - The Zuri                         1
Salt - Indian Restaurant - Bar & Grill     1
Dilli Dil Se..                             1
Mothi Restaurant                           1
Name: name, Length: 3157, dtype: int64
In [58]:
# df['name'].value_counts()
In [59]:
df['name'].value_counts().head(20)
Out[59]:
Onesta                    85
Empire Restaurant         67
KFC                       59
McDonald's                57
Pizza Hut                 56
Domino's Pizza            55
Faasos                    54
Smally's Resto Cafe       54
Corner House Ice Cream    52
Burger King               51
Polar Bear                48
Mani's Dum Biryani        47
Smoor                     47
Pizza Stop                46
Subway                    45
Chung Wah                 45
Mainland China            45
Lakeview Milkbar          44
Hammered                  44
eat.fit                   44
Name: name, dtype: int64
In [60]:
#Create a data frame with top 20 restaurants 
In [62]:
chains=df['name'].value_counts()[:20]
display(chains)
Onesta                    85
Empire Restaurant         67
KFC                       59
McDonald's                57
Pizza Hut                 56
Domino's Pizza            55
Faasos                    54
Smally's Resto Cafe       54
Corner House Ice Cream    52
Burger King               51
Polar Bear                48
Mani's Dum Biryani        47
Smoor                     47
Pizza Stop                46
Subway                    45
Chung Wah                 45
Mainland China            45
Lakeview Milkbar          44
Hammered                  44
eat.fit                   44
Name: name, dtype: int64
In [63]:
# Bar chat with Top 20 restaurants with number of outlets
In [65]:
plt.figure(figsize=(20,15))
chains=df['name'].value_counts()[:20]
sns.barplot(x=chains,y=chains.index,palette='deep')
plt.title("Most famous restaurants chains in Bangaluru")
plt.xlabel("Number of outlets")
plt.show()
In [66]:
# Restaurants with Table Booking 
In [67]:
# Restaurants with Table Booking 
In [68]:
display(df['book_table'].value_counts())
No     17191
Yes     6057
Name: book_table, dtype: int64
In [69]:
# Create a Pie chart 
In [70]:
x=df['book_table'].value_counts()
colors = ['#800080', '#0000A0']

trace=go.Pie(labels=x.index,values=x,textinfo="value",
            marker=dict(colors=colors, 
                           line=dict(color='#001000', width=2)))
layout=go.Layout(title="Table booking",width=600,height=600)
fig=go.Figure(data=[trace],layout=layout)
py.iplot(fig, filename='pie_chart_subplots')
In [71]:
# Restaurants with Delivering online or not
In [72]:
# Create a count plot with delivering  online or not
In [73]:
sns.countplot(df['online_order'])
fig = plt.gcf()
fig.set_size_inches(10,10)
plt.title('Whether Restaurants deliver online or Not')
plt.show() 
In [74]:
#Rating Distribution 
In [75]:
# Ratings distribution - Most of the ratings are within 3.5 and 4.5
In [76]:
plt.figure(figsize=(15,7))
sns.distplot(df['rate'],bins=20)
Out[76]:
<AxesSubplot:xlabel='rate', ylabel='Density'>
In [77]:
# Number of Restaurants with Rating Range
In [78]:
# Count of ratings as between "1 and 2", "2 and 3", "3 and 4", and "4 and 5"
# Display Unique Rating
In [79]:
display(df['rate'].unique())
array(['4.1', '3.8', '3.7', '4.6', '4.0', '4.2', '3.9', '3.0', '3.6',
       '2.8', '4.4', '3.1', '4.3', '2.6', '3.3', '3.5', '3.8 ', '3.2',
       '4.5', '2.5', '2.9', '3.4', '2.7', '4.7', '2.4', '2.2', '2.3',
       '4.8', '3.9 ', '4.2 ', '4.0 ', '4.1 ', '2.9 ', '2.7 ', '2.5 ',
       '2.6 ', '4.5 ', '4.3 ', '3.7 ', '4.4 ', '4.9', '2.1', '2.0', '1.8',
       '3.4 ', '3.6 ', '3.3 ', '4.6 ', '4.9 ', '3.2 ', '3.0 ', '2.8 ',
       '3.5 ', '3.1 ', '4.8 ', '2.3 ', '4.7 ', '2.4 ', '2.1 ', '2.2 ',
       '2.0 ', '1.8 '], dtype=object)
In [80]:
# Minimum Rating
In [81]:
display(df['rate'].max())
'4.9 '
In [83]:
# Convert Rating from string to float
In [84]:
df['rate']=df['rate'].astype(float)
display(df['rate'].unique())
array([4.1, 3.8, 3.7, 4.6, 4. , 4.2, 3.9, 3. , 3.6, 2.8, 4.4, 3.1, 4.3,
       2.6, 3.3, 3.5, 3.2, 4.5, 2.5, 2.9, 3.4, 2.7, 4.7, 2.4, 2.2, 2.3,
       4.8, 4.9, 2.1, 2. , 1.8])
In [85]:
# Create Histogram
In [86]:
group= [1,2,3,4,5]
plt.hist (df['rate'],group,histtype = 'bar',rwidth =0.5,color = 'b')
plt.show()
In [87]:
# Number of Restaurants with Rating Between 1 and 2
In [88]:
gr_1to2=((df['rate']>=1) & (df['rate']<2)).sum()
display (gr_1to2)
5
In [89]:
# Number of Restaurants with Rating Between 2 and 3
In [90]:
gr_2to3=((df['rate']>=2) & (df['rate']<3)).sum()
display (gr_2to3)
1179
In [91]:
# Number of Restaurants with Rating Between 3 and 4
In [92]:
gr_3to4=((df['rate']>=3) & (df['rate']<4)).sum()
display (gr_3to4)
10153
In [93]:
# Number of Restaurants with Rating more than 4
In [94]:
gr_4to5=(df['rate']>=4).sum()
display (gr_4to5)
11911
In [95]:
display (gr_4to5)
11911
In [96]:
# # gr_4to5=(df['rate']>=4).sum()
In [97]:
slices=[gr_1to2,gr_2to3,gr_3to4,gr_4to5]   
In [98]:
labels=['Rating 1 to 2','Rating 2 to 3','Rating 3 to 4','Rating >4']
colors = ['#ff3333','#c2c2d6','#6699ff']
plt.pie(slices,colors=colors, labels=labels, autopct='%1.0f%%', pctdistance=.5, labeldistance=1.2,shadow=True)
fig = plt.gcf()
plt.title("Percentage of Restaurants according to their ratings")

fig.set_size_inches(10,10)
plt.show()
In [99]:
# Service Type
In [100]:
# Count distinct Value by service Types 
In [101]:
display(df['type'].value_counts())
Delivery              10657
Dine-out               8006
Desserts               1364
Cafes                  1066
Drinks & nightlife      879
Buffet                  753
Pubs and bars           523
Name: type, dtype: int64
In [102]:
# Service Type - count Plot
In [103]:
# Here the two main service types are Delivery and Dine-out
In [104]:
sns.countplot(df['type']).set_xticklabels(sns.countplot(df['type']).get_xticklabels(), rotation=90, ha="right")
fig = plt.gcf()
fig.set_size_inches(20,12)
plt.title('Type of Service')
plt.show()
In [105]:
# Distribution of Cost of Food for Two People 

# Display Unique Cost 
In [107]:
two_people_cost = df['cost'].unique()
display(np.sort(two_people_cost))
array([  40.,  100.,  120.,  150.,  180.,  200.,  230.,  250.,  300.,
        330.,  350.,  400.,  450.,  500.,  550.,  600.,  650.,  700.,
        750.,  800.,  850.,  900.,  950., 1000., 1050., 1100., 1200.,
       1250., 1300., 1350., 1400., 1450., 1500., 1600., 1650., 1700.,
       1800., 1900., 2000., 2100., 2200., 2300., 2400., 2500., 2600.,
       2700., 2800., 3000., 3200., 3400., 3500., 3700., 4000., 4100.,
       4500., 5000., 6000.])
In [108]:
# Number of Restaurants in each group 
In [109]:
df.groupby('cost').size()
Out[109]:
cost
40.0         8
100.0      120
120.0        2
150.0      371
180.0       17
200.0      869
230.0       10
250.0      697
300.0     1688
330.0        4
350.0      553
400.0     2478
450.0      719
500.0     2321
550.0      440
600.0     2168
650.0      644
700.0     1202
750.0      651
800.0     1647
850.0      122
900.0      524
950.0       47
1000.0    1218
1050.0       4
1100.0     450
1200.0     903
1250.0       8
1300.0     496
1350.0      18
1400.0     447
1450.0       5
1500.0     841
1600.0     237
1650.0       6
1700.0     229
1800.0     193
1900.0      58
2000.0     298
2100.0      60
2200.0      39
2300.0       1
2400.0      22
2500.0     143
2600.0       4
2700.0       2
2800.0      31
3000.0     159
3200.0       2
3400.0      13
3500.0      25
3700.0       1
4000.0      24
4100.0       4
4500.0       2
5000.0       1
6000.0       2
dtype: int64
In [110]:
# Create a Box Plot 
In [111]:
from plotly.offline import iplot
trace0=go.Box(y=df['cost'],name="accepting online orders",
              marker = dict(
        color = 'rgb(113, 10, 100)',
    ))
data=[trace0]
layout=go.Layout(title="Box plot of approximate cost",width=800,height=800,yaxis=dict(title="Price"))
fig=go.Figure(data=data,layout=layout)
py.iplot(fig)
In [112]:
#  Dist plot of cost for the cost
In [113]:
plt.figure(figsize=(8,8))
sns.distplot(df['cost'])
plt.show()
In [114]:
# Most Liked Food 
In [115]:
# Extract the favourite food from column – dish_liked
#re=regular expression (use for splitting words). 
# The split is used since dish liked column has multiple values separated by comma, extract each dish, create a list (append each value to list)
In [118]:
import re
df.index=range(df.shape[0])
likes=[]
for i in range(df.shape[0]):
    array_split=re.split(',',df['dish_liked'][i])
    for item in array_split:
        likes.append(item)
In [119]:
# Display the number of dishes and dishes 
In [120]:
display ('Number of dishes', len(likes))
display(likes)
'Number of dishes'
126848
['Pasta',
 ' Lunch Buffet',
 ' Masala Papad',
 ' Paneer Lajawab',
 ' Tomato Shorba',
 ' Dum Biryani',
 ' Sweet Corn Soup',
 'Momos',
 ' Lunch Buffet',
 ' Chocolate Nirvana',
 ' Thai Green Curry',
 ' Paneer Tikka',
 ' Dum Biryani',
 ' Chicken Biryani',
 'Churros',
 ' Cannelloni',
 ' Minestrone Soup',
 ' Hot Chocolate',
 ' Pink Sauce Pasta',
 ' Salsa',
 ' Veg Supreme Pizza',
 'Masala Dosa',
 'Panipuri',
 ' Gol Gappe',
 'Onion Rings',
 ' Pasta',
 ' Kadhai Paneer',
 ' Salads',
 ' Salad',
 ' Roti',
 ' Jeera Rice',
 'Farmhouse Pizza',
 ' Chocolate Banana',
 ' Virgin Mojito',
 ' Pasta',
 ' Paneer Tikka',
 ' Lime Soda',
 ' Prawn Pizza',
 'Pizza',
 ' Mocktails',
 ' Coffee',
 ' Nachos',
 ' Salad',
 ' Pasta',
 ' Sandwiches',
 'Waffles',
 ' Pasta',
 ' Coleslaw Sandwich',
 ' Choco Waffle',
 ' Tacos',
 ' Momos',
 ' Cheese Nachos',
 'Waffles',
 ' Pasta',
 ' Crispy Chicken',
 ' Honey Chilli Chicken',
 ' Sandwich',
 ' Coffee',
 ' Crepe',
 'Mocktails',
 ' Peri Fries',
 ' Lasagne',
 ' Pizza',
 ' Chicken Bbq Wings',
 ' Virgin Mojito',
 ' Nachos',
 'Coffee',
 ' Spaghetti',
 ' Pancakes',
 ' Nachos',
 ' Pasta',
 ' Sandwich',
 ' Garlic Bread',
 'Sandwich',
 ' Omelette',
 ' Ice Tea',
 ' Virgin Mojito',
 ' Hot Chocolate',
 ' Pasta Arrabiata',
 ' Hazelnut Cappuccino',
 'Churros',
 ' Cannelloni',
 ' Minestrone Soup',
 ' Hot Chocolate',
 ' Pink Sauce Pasta',
 ' Salsa',
 ' Veg Supreme Pizza',
 'Garlic Bread',
 ' Burgers',
 ' Sandwiches',
 ' Pizza',
 ' Hot Chocolate Fudge',
 ' Waffles',
 ' Potato Wedges',
 'Momos',
 ' Mushroom Bruschettas',
 ' Jalapeno Cheeseballs',
 ' Pasta',
 ' Red Velvet Shake',
 ' Red Velvet Milkshake',
 ' Maggi',
 'Pasta',
 ' Gelato',
 ' Garlic Bread',
 ' Mojito',
 ' Nachos',
 ' Paneer Pizza',
 ' Mocktails',
 'Cheese Maggi',
 ' Peri Peri Fries',
 ' Pasta Arrabiata',
 'Burgers',
 ' Caramel Milkshake',
 ' Iced Coffee',
 ' Iced Tea',
 'Pizza',
 ' Garlic Bread',
 'Pasta',
 ' Iced Tea',
 'Paratha',
 ' Sandwich',
 ' Chilli Idli',
 ' Noodles',
 ' Sandwiches',
 ' Lime Soda',
 'Pizza',
 ' Fries',
 ' Anjeer Ice Cream',
 ' Sandwiches',
 ' Gelato',
 ' Burgers',
 ' Kesar Badam',
 'Burgers',
 ' Lassi',
 ' Chicken Grill',
 ' Naan',
 ' Momos',
 ' Chicken Burger',
 ' Biryani',
 'Paneer Tikka',
 ' Garlic Bread',
 ' Thin Crust Pizza',
 ' Falafel',
 ' Veggie Pizza',
 'Rolls',
 ' Veggie Wrap',
 ' Chocolate Fantasy',
 ' Rice Bowls',
 ' Chicken Rice',
 ' Paneer Makhanwala',
 ' Chicken Tikka Wrap',
 'Raita',
 ' Gulab Jamun',
 ' Paneer Biryani',
 ' Vegetable Biryani',
 ' Gosht Dum Biryani',
 ' Chicken Biryani',
 ' Murgh Biryani',
 'Noodles',
 ' Momos',
 ' Veg Manchow Soup',
 ' Kung Pao Chicken',
 ' Chicken Lollipop',
 ' Chop Suey',
 ' Dragon Chicken',
 'Chicken Tikka Masala',
 ' Mutton Keema Dosa',
 ' Mutton Biryani',
 ' Raan Biryani',
 ' Brain Fry',
 ' Chicken Grill',
 ' Ghee Rice',
 'Dabeli',
 ' Faluda',
 ' Masala Poori',
 ' Sandwiches',
 ' Tokri Chaat',
 ' Pav Bhaji',
 ' Dahipuri',
 'Burgers',
 ' Fries',
 ' Hot Chocolate',
 'Pane Pizza',
 ' Lava Cake',
 ' Pasta',
 ' Stuffed Garlic Bread',
 ' Chocolava Cake',
 ' Tacos',
 'Farmhouse Pizza',
 ' Chocolate Banana',
 ' Virgin Mojito',
 ' Pasta',
 ' Paneer Tikka',
 ' Lime Soda',
 ' Prawn Pizza',
 'Prompt Service',
 'Biryani',
 'Butter Chicken',
 ' Noodles',
 ' Thali',
 ' Biryani',
 'Momos',
 ' Dragon Chicken',
 ' Hakka Noodles',
 ' Chowmein',
 ' Chop Suey',
 ' Chilli Garlic Noodles',
 ' Garlic Rice',
 'Paratha',
 ' Pasta',
 'Hot Chocolate Fudge',
 ' Vanilla Ice Cream',
 ' Fudge Cake',
 ' Chocolate Mousse',
 'Prawn Biryani',
 ' Dragon Chicken',
 ' Chicken Boneless Biryani',
 ' Afghani Biryani',
 ' Mughlai Biryani',
 ' Paneer Tikka Biryani',
 ' Gongura Biryani',
 'Pasta',
 ' Momos',
 ' Rolls',
 ' Chicken Roll',
 ' Chilli Chicken',
 ' Paneer Roll',
 ' Spaghetti',
 'Salads',
 ' Sandwiches',
 ' Salad',
 ' Thai Rice',
 ' Pasta',
 ' Noodles',
 ' Pizza',
 'Sushi',
 ' Noodles',
 ' Wine',
 ' Khau Suey',
 ' Mocktails',
 ' Yakisoba',
 ' Spring Roll',
 'Pasta',
 ' Pepper Pizza',
 ' Paneer Pizza',
 ' Peppy Paneer',
 ' Nachos',
 ' Supreme Pizza',
 ' Manchow Soup',
 'Sea Food',
 ' Crab Meat',
 ' Crab Soup',
 ' Fish Curry',
 ' Chicken Cafreal',
 ' Butter Naan',
 ' Butter Chicken',
 'Salads',
 ' Panneer Butter Masala',
 ' Rabri',
 ' Gajar Ka Halwa',
 ' Manchow Soup',
 ' Aam Panna',
 ' Tomato Basil Soup',
 'Grape Juice',
 ' Chicken Grill',
 ' Chicken Tikka Roll',
 ' Shawarma Roll',
 ' Chicken Shawarama',
 ' Biryani Combo',
 ' Rolls',
 'Beer',
 ' Wedges',
 ' Pizza',
 ' Nachos',
 ' Salads',
 ' Papaya Salad',
 ' Buffalo Wings',
 'Vegetable Biryani',
 ' Ginger Chicken',
 ' Chicken Biryani',
 ' Donne Biryani',
 ' Chicken Kebab',
 ' Egg Bhurji',
 ' Dum Biryani',
 'Rolls',
 ' Momos',
 ' Fries',
 ' Veggie Roll',
 ' Chicken Kebab Roll',
 ' Paneer Roll',
 ' Cheese Roll',
 'Benne Dosa',
 ' Mirchi Bajji',
 ' Filter Coffee',
 ' Poha',
 ' Tea',
 ' Butter Dosa',
 ' Crispy Dosa',
 'Masala Dosa',
 'Berryblast',
 ' Waffles',
 ' Cheesecake',
 ' Salted Caramel',
 'Chicken Boneless Biryani',
 ' Hyderabadi Biryani',
 ' Paneer Biryani',
 ' Tandoori Chicken',
 ' Vegetable Biryani',
 ' Chicken Kebab',
 ' Raita',
 'Biryani',
 ' Chicken Guntur',
 ' Thali',
 ' Buttermilk',
 ' Manchurian',
 'Chilli Chicken',
 'Panipuri',
 ' Chaat',
 ' Noodles',
 ' Dahi Bhalle',
 'Hot Chocolate Fudge',
 'Rooftop Ambience',
 'Coffee',
 ' Tea',
 ' Kesari Bath',
 ' Open Dosa',
 ' Vada',
 ' Idli',
 ' Bread Dosa',
 'Cup Cake',
 ' Chocolate Cake',
 'Masala Dosa',
 ' Tirupathi Pongal',
 ' Filter Coffee',
 ' Vada',
 ' Kharabath',
 ' Kali Dosa',
 ' Rava Idli',
 'Panner Tikka',
 ' Kulfi',
 ' Coffee',
 ' Pav Bhaji',
 ' Carrot Halwa',
 ' Fried Rice',
 ' Set Dosa',
 'Paneer Tikka',
 ' Dal Kichadi',
 ' French Fries',
 'Filter Coffee',
 ' Masala Dosa',
 ' Idli',
 ' Vada',
 'Rolls',
 ' Shawarma',
 ' Butter Chicken',
 ' Mutton Biryani',
 ' Lahori Chicken',
 ' Chicken Roll',
 ' Grape Juice',
 'Rolls',
 ' Paratha',
 ' Chicken Biryani',
 'Paratha',
 ' Mughlai Chicken',
 ' Masala Lemonade',
 ' Butter Chicken',
 ' Rajma',
 ' Sandwich',
 ' Salad',
 'Burgers',
 ' French Fries',
 'Rolls',
 ' Ice Cream Roll',
 ' Paan Ice Cream',
 ' Coffee',
 ' Vanilla Ice Cream',
 ' Chocolate Icecreams',
 ' Mississippi Mudpie',
 'Kadhai Paneer',
 ' Ghee Rice',
 ' Chicken Grill',
 ' Shawarma',
 ' Paratha',
 ' Biryani',
 ' Butter Chicken',
 'Chicken Biryani',
 ' Rolls',
 'Roast Pork',
 ' Tai Pai Chicken',
 ' Beer',
 ' Sweet Corn Chicken Soup',
 ' Masala Peanuts',
 ' Chinese Chop Suey',
 ' Chicken Lollipop',
 'Pizza',
 ' Nachos',
 ' Garlic Maggi',
 ' Burgers',
 ' Cheese Maggi',
 ' Bruschetta Bites',
 ' Sandwich',
 'Noodles',
 ' Laksa Soup',
 ' Coffee',
 ' Veg Fritters',
 ' Vegetarian',
 ' Babycorn Manchurian',
 ' Mango Salad',
 'Lassi',
 'Coffee',
 ' Chaat',
 'Pizza',
 ' Nachos',
 ' Salads',
 ' Peri Peri Fries',
 ' Brownie',
 ' Pasta Alfredo',
 ' Spaghetti',
 'Chicken Grill',
 ' Biryani',
 ' Roti',
 ' Chicken Masala',
 'Chaat',
 ' Pav Bhaji',
 ' Dabeli',
 ' Vada Pav',
 ' Tawa Pulav',
 ' Panipuri',
 ' Malpua',
 'Pizza',
 ' Burgers',
 'Burgers',
 ' Panneer Butter Masala',
 ' Pasta',
 ' Hot Dog',
 ' Fries',
 ' Cheesy Pizza',
 ' Potato Wedges',
 'Sandwiches',
 ' Thick Shakes',
 ' Paan Shake',
 ' Brownie Bomb',
 ' Fries',
 ' Spinach Corn Sandwich',
 ' Paneer Peri Peri',
 'Pizza',
 ' Pasta',
 ' Spinach Salsa',
 ' Garlic Bread',
 ' Lasagne',
 ' Bruschettas',
 ' Chocolate Bomb',
 'Friendly Staff',
 'Biryani',
 'Paratha',
 ' Vada Pav',
 ' Chaat',
 ' Pav Bhaji',
 ' Panipuri',
 ' Masala Poori',
 ' Dhokla',
 'Whole Meat Shawarma',
 ' Fries',
 'Panneer Butter Masala',
 ' Lassi',
 ' Paratha',
 ' Jeera Rice',
 ' Paneer Parantha',
 ' Bhindi Fry',
 ' Veg Kolhapuri',
 'Waffles',
 ' Pasta',
 ' Crispy Chicken',
 ' Honey Chilli Chicken',
 ' Sandwich',
 ' Coffee',
 ' Crepe',
 'Masala Papad',
 ' Paneer Satay',
 ' Vegetable Biryani',
 ' Panneer Butter Masala',
 ' Tomato Soup',
 ' Manchow Soup',
 ' Roti',
 'Shawarma',
 ' Biryani',
 ' Bbq Chicken',
 ' Chicken Grill',
 ' Raita',
 'Jowar Roti',
 ' Buttermilk',
 ' Sabudana Vada',
 ' Thali',
 ' Mirchi Bajji',
 ' Brinjal Curry',
 'Burgers',
 ' Caramel Milkshake',
 ' Iced Coffee',
 ' Iced Tea',
 'Supreme Pizza',
 ' Potato Wedges',
 ' Masala Lemonade',
 ' Tandoori Paneer',
 ' Exotic Garlic Bread',
 'Neer Dosa',
 ' Sea Food',
 ' Ghee Rice',
 ' Marwai Sukka',
 ' Egg Biryani',
 ' Kori Roti',
 ' Thai Fish',
 'White Pasta',
 ' Noodles',
 ' Babycorn Manchurian',
 ' Pizza',
 ' Veg Momos',
 ' Fry Momos',
 ' Tawa Pulav',
 'Masala Dosa',
 ' Sandwiches',
 ' Coffee',
 ' Onion Dosa',
 ' Rava Dosa',
 ' Chaat',
 ' Sandwich',
 'French Fries',
 ' Burgers',
 'Paratha',
 ' Boondi Raita',
 ' Roti',
 ' Kulfi',
 ' Panneer Butter Masala',
 ' Sweet Lassi',
 ' Dal Tadka',
 'Veg Momos',
 ' Brownie Chocolate',
 ' Palak Chaat',
 ' Mutton Biryani',
 ' Dahipuri',
 ' Fish',
 ' Sea Food',
 'Noodles',
 ' Pasta',
 ' Schezwan Momos',
 ' Chicken Momo',
 ' Teriyaki Chicken',
 ' Thukpa',
 ' Fries',
 'Spring Roll',
 ' Manchow Soup',
 ' Babycorn Manchurian',
 ' Mint Cooler',
 ' Roti',
 ' Panneer Butter Masala',
 'Biryani',
 'Pho',
 ' Papaya Salad',
 ' Coffee',
 ' Veg Momos',
 ' Rolls',
 'Waffles',
 ' Pasta',
 ' Coleslaw Sandwich',
 ' Choco Waffle',
 ' Tacos',
 ' Momos',
 ' Cheese Nachos',
 'Pizza',
 ' Pasta',
 ' Salads',
 ' Calamari',
 ' Ravioli',
 ' Pumpkin Soup',
 ' Wine',
 'Nachos',
 ' Cup Cake',
 ' Hot Chocolate Fudge',
 ' Salsa',
 ' Cheesy Garlic Bread',
 ' Waffles',
 ' Tiramisu',
 'Lime Soda',
 ' Manchow Soup',
 ' Biryani',
 ' Lemon Chicken',
 ' Tomato Soup',
 ' Butter Naan',
 ' Chilli Chicken',
 'Murgh Ghee Roast',
 ' Fish Fry',
 ' Ghee Roast Paneer',
 ' Neer Dosa',
 ' Appam',
 ' Sea Food',
 ' Chicken Sukha',
 'Ragi Mudde',
 ' Lemon Chicken',
 ' Chilli Chicken',
 ' Chicken Curry',
 ' Mutton Chops',
 ' Mutton Biryani',
 'Pasta',
 ' Potato Fries',
 ' Potato Wedges',
 ' Hot Chocolate',
 ' Chaat',
 ' Filter Coffee',
 ' Americano',
 'Sweet Lassi',
 ' Gulab Jamun',
 ' Palak Paneer Paratha',
 ' Paneer Parantha',
 'Pizza',
 ' White Sauce Pasta',
 ' Masala Garlic Bread',
 'Burgers',
 ' Fries',
 ' Mojito',
 ' Chicken Burger',
 'Paratha',
 ' Sandwich',
 ' Chilli Idli',
 ' Noodles',
 ' Sandwiches',
 ' Lime Soda',
 'Chicken Biryani',
 ' Mutton Biryani',
 ' Egg Biryani',
 ' Chicken Fry',
 ' Mutton Fry',
 'Chaat',
 ' Brownie',
 ' Onion Rings',
 ' Tomato Soup',
 ' Paneer Manchurian',
 ' Thali',
 ' Faluda',
 'Sandwiches',
 ' Chocolate Sandwich',
 ' Chaat',
 ' Veg Cheese Sandwich',
 ' Chilli Cheese',
 ' Corn Sandwich',
 'Prawn Biryani',
 ' Andhra Meal',
 ' Veg Thali',
 ' Fry Piece Biryani',
 ' Gongura Chicken',
 ' Paratha',
 'Veggie Delight',
 ' Paneer Tikka',
 ' Salad',
 'Faluda',
 ' Brownie',
 ' Sandwich',
 ' Kulfi',
 ' Fruit Salad',
 ' Sweet Lassi',
 ' Chocolate Fudge',
 'Pav Bhaji',
 ' Masala Dosa',
 ' Idli Vada',
 ' Filter Coffee',
 ' Pongal',
 ' Curd Rice',
 ' Kesari Bath',
 'Roti',
 ' Masala Dosa',
 'Onion Rings',
 ' Pasta',
 ' Kadhai Paneer',
 ' Salads',
 ' Salad',
 ' Roti',
 ' Jeera Rice',
 'Masala Papad',
 ' Paneer Satay',
 ' Paneer Hyderabadi',
 ' Butter Naan',
 ' Roti',
 'Stuffed Mushroom',
 ' Chicken Biryani',
 ' Jal-jeera',
 'Filter Coffee',
 ' Tea',
 ' Hot Coffee',
 ' Hatti Samosa',
 'Masala Dosa',
 'Badam Milk',
 ' Potato Twister',
 ' Pav Bhaji',
 ' Panipuri',
 ' Tikki Chaat',
 ' Cheese Cutlet',
 'Pasta',
 ' Iced Tea',
 'Roti',
 ' Butter Kulcha',
 ' Fried Rice',
 ' Tomato Soup',
 ' Curd Rice',
 ' Lunch Buffet',
 ' Paneer Tikka',
 'Chicken Biryani',
 'Chicken Biryani',
 ' Ragi Mudde',
 ' Mutton Chops',
 'Masala Dosa',
 ' Coffee',
 'Cocktails',
 ' Paneer Tikka',
 ' Rasmalai',
 ' Rabri',
 ' Masala Papad',
 ' Vegetable Biryani',
 ' Chicken Curry',
 'Garlic Bread',
 ' Burgers',
 ' Sandwiches',
 ' Pizza',
 ' Hot Chocolate Fudge',
 ' Waffles',
 ' Potato Wedges',
 'Veggie Pizza',
 ' Garlic Bread',
 ' Lava Cake',
 ' Chocolava',
 ' Spicy Paneer',
 'Kharabath',
 ' Crispy Vada',
 ' Filter Coffee',
 ' Idli Vada',
 ' Idli Chutney',
 ' Kesari Bath',
 ' Gulab Jamun',
 'Noodles',
 ' Veg Momos',
 ' Chowmein',
 ' Schezwan Fried Rice',
 ' Clear Soup',
 ' Sweet Corn Soup',
 ' Chicken Wings',
 'Veg Thali',
 ' Matka Kulfi',
 ' Pongal',
 ' Buttermilk',
 ' Vada',
 ' Ragi Mudde',
 ' Curd Rice',
 'Coffee',
 ' Sandwich',
 ' Hot Chocolate',
 ' Ice Tea',
 ' Sandwiches',
 ' Chicken Lasagne',
 ' Pizza',
 'Jowar Roti',
 ' Buttermilk',
 ' Jolada Rotti',
 ' Brinjal Curry',
 ' Coffee',
 ' Pongal',
 ' Vegetable Biryani',
 'Pizza',
 ' Garlic Bread',
 'Sweet Pongal',
 ' Mini Idlis',
 ' Filter Coffee',
 ' Open Masala Dosa',
 ' Pakoda',
 ' Vada',
 ' Raagi Dosa',
 'Paratha',
 ' Coffee',
 ' Halwa',
 ' Lassi',
 'Vegetable Biryani',
 ' Pineapple Rasam',
 ' Cheese Garlic Naan',
 ' Potato Cheese Ball',
 ' Bamboo Chicken Biryani',
 ' Chicken Skewer',
 ' Fish',
 'Malai Kofta',
 ' Sandwich',
 ' Naan',
 'Momos',
 ' Lunch Buffet',
 ' Chocolate Nirvana',
 ' Thai Green Curry',
 ' Paneer Tikka',
 ' Dum Biryani',
 ' Chicken Biryani',
 'Coffee',
 ' Masala Dosa',
 'Sea Food',
 ' Neer Dosa',
 ' Anjal Masala Fry',
 ' Coconut Pudding',
 ' Chicken Biryani',
 ' Roti',
 ' Fish Curry',
 'Tandoori Chicken',
 ' Rolls',
 'Pasta',
 ' Nachos',
 ' Jalapeno Poppers',
 ' Burrito Bowl',
 ' Ferrero Rocher Shake',
 ' Falafal Sandwich',
 ' Banana Waffles',
 'Pizza',
 ' Mocktails',
 ' Coffee',
 ' Nachos',
 ' Salad',
 ' Pasta',
 ' Sandwiches',
 'Aloo Paratha',
 'Rava Dosa',
 'Momos',
 ' Mushroom Bruschettas',
 ' Jalapeno Cheeseballs',
 ' Pasta',
 ' Red Velvet Shake',
 ' Red Velvet Milkshake',
 ' Maggi',
 'Pesto Pizza',
 'Sandwiches',
 ' Noodles',
 ' Sandwich',
 'Lasagne',
 ' Steak',
 ' Masala Quesadilla',
 ' Garlic Bread',
 'Breakfast Buffet',
 ' Kulcha',
 ' Almond Soup',
 ' Lunch Buffet',
 ' Roti',
 ' Mocktails',
 ' Vegetarian',
 'Hara Bhara Kabab',
 ' Crispy Corn',
 ' Patiala Paneer',
 ' Panneer Butter Masala',
 ' Dum Biryani',
 ' Jal-jeera',
 ' Butter Naan',
 'Waffles',
 ' Cup Cake',
 ' Chocolate Cake',
 'Waffles',
 'Momos',
 ' Burgers',
 ' Rolls',
 ' Sandwich',
 ' Hot Chocolate',
 ' Tea',
 ' Naga Thali',
 'Freak Shake',
 ' Fries',
 ' Pasta Alfredo',
 'Butter Chicken',
 ' Chicken Grill',
 ' Tandoori Chicken',
 ' Noodles',
 ' Biryani',
 ' Fried Rice Chicken',
 'Pizza',
 ' Pasta',
 ' Nachos',
 ' Burgers',
 ' Sandwich',
 ' Tea',
 ' Cheese Balls',
 'Masala Chai',
 ' Coffee',
 ' Masala Tea',
 ' Maggi',
 'Pasta',
 ' Gelato',
 ' Garlic Bread',
 ' Mojito',
 ' Nachos',
 ' Paneer Pizza',
 ' Mocktails',
 'Salad',
 ' Mocktails',
 ' Chocolava',
 ' Pesto Pasta',
 ' Momos',
 ' Jasmine Rice',
 ' Tom Yum Soup',
 'Vada',
 ' Masala Dosa',
 ' Idli',
 'Coffee',
 ' Masala Dosa',
 ' Vegetable Biryani',
 'Pasta',
 ' Pizza',
 ' Burgers',
 ' Pancakes',
 ' Garlic Bread',
 'Maggi',
 ' Pasta',
 ' Burgers',
 ' Sandwiches',
 ' Fries',
 'Sea Food',
 ' Neer Dosa',
 'Pizza',
 'Brownie',
 ' Mojito',
 ' Prawn Ghee Roast',
 ' Corn Tikki',
 ' Mushroom Ghee Roast',
 ' Pinacolada',
 ' Biryani',
 'Biryani',
 ' Thick Shakes',
 ' Fries',
 'Vegetarian',
 'Sweet Pongal',
 ' Curd Rice',
 'Pesto Pizza',
 ' Buffalo Wings',
 ' Cocktails',
 ' Beer',
 ' Egg Ghee Roast',
 ' Brownie',
 ' Pepper Chicken',
 'Waffles',
 ' Sandwiches',
 ' Maggi',
 ' Thick Shakes',
 ' Chocolate Sandwich',
 'Honey Chilli Potatoes',
 ' Nachos',
 ' Lemonade',
 ' Hakka Noodles',
 ' Babycorn Manchurian',
 ' Mushroom Manchurian',
 ' Spring Roll',
 'Manchow Soup',
 ' Momos',
 ' Wonton Soup',
 ' Chowmein',
 ' American Chopsuey',
 ' Chop Suey',
 ' Manchurian',
 'Pasta',
 ' Pizza',
 ' Nachos',
 ' Gelato',
 ' Ravioli',
 ' Jalapeno Poppers',
 ' Cocktails',
 'Masala Vada Pav',
 ' Cheese Vada Pav',
 ' Fries',
 'Corn Augratin',
 ' Lasagne',
 ' Fries',
 ' Garlic Bread',
 ' Pili Pili Pizza',
 ' Mexican Rice',
 ' Ravioli',
 'Salads',
 ' Sandwiches',
 ' Pasta',
 ' Mocktails',
 ' Corn Sandwich',
 ' Garden Salad',
 ' Miso Salad',
 'Coffee',
 ' Thali',
 ' Kharabath',
 ' Masala Dosa',
 ' Idli Vada',
 ' Vanilla Ice Cream',
 ' Bisi Bele Bhaath',
 'Veg Jaipuri',
 ' Neer Dosa',
 ' Kulcha',
 ' Pepper Chicken',
 ' Chilli Mushroom',
 ' Murgh Platter',
 ' Paneer Tikka',
 'Pizza',
 ' Pasta Alfredo',
 ' Brownie',
 ' Garlic Bread',
 ' Sandwiches',
 ' Lemon Mojito',
 ' Mocha Fudge',
 'Mocktails',
 ' Tomato Soup',
 ' Pasta',
 ...]
In [ ]:
# Index
In [121]:
df.index=range(df.shape[0])
df.index
Out[121]:
RangeIndex(start=0, stop=23248, step=1)
In [122]:
# Display top 30 dishes
In [123]:
print("Count of Most liked dishes")
favourite_food = pd.Series(likes).value_counts()
display(favourite_food.head(30))
Count of Most liked dishes
 Pasta              2692
 Pizza              1915
 Cocktails          1880
 Burgers            1736
 Mocktails          1623
 Biryani            1307
 Sandwiches         1287
Burgers             1256
 Coffee             1184
 Nachos             1170
 Fish               1116
 Paratha            1107
 Salads             1055
 Chicken Biryani    1004
Cocktails            891
 Fries               876
 Noodles             854
 Beer                835
 Mutton Biryani      832
 Tea                 819
Coffee               801
 Sandwich            788
 Butter Chicken      782
 Thali               770
Biryani              749
Pizza                747
 Roti                729
 Brownie             726
 Salad               677
 Hot Chocolate       672
dtype: int64
In [124]:
# Create Bar Graph with top 20 dishes 
#We can infer from the analysis that the 5 most liked dishes are Pasta,Pizza,Cocktails,Burgers,and Mocktails
In [125]:
ax = favourite_food.nlargest(n=20, keep='first').plot(kind='bar',figsize=(20,15),title = 'Top 30 Favourite Food counts ')

for i in ax.patches:
    ax.annotate(str(i.get_height()), (i.get_x() * 1.005, i.get_height() * 1.005))
In [126]:
# Restaurant Type and Count 
# Restaurant Type and Count 
In [127]:
df['rest_type'].value_counts().head(50)
Out[127]:
Casual Dining                    7326
Quick Bites                      5250
Cafe                             2375
Dessert Parlor                   1083
Casual Dining, Bar                985
Delivery                          704
Bar                               358
Takeaway, Delivery                342
Bar, Casual Dining                336
Pub                               324
Fine Dining                       311
Casual Dining, Cafe               304
Lounge                            298
Pub, Casual Dining                224
Food Court                        220
Bakery                            166
Cafe, Casual Dining               159
Dessert Parlor, Cafe              143
Beverage Shop                     137
Beverage Shop, Quick Bites        137
Cafe, Bakery                      128
Casual Dining, Pub                124
Microbrewery, Casual Dining       121
Cafe, Dessert Parlor              111
Sweet Shop                        105
Bakery, Quick Bites                96
Sweet Shop, Quick Bites            88
Pub, Microbrewery                  76
Dessert Parlor, Quick Bites        71
Bakery, Cafe                       69
Bakery, Dessert Parlor             62
Quick Bites, Dessert Parlor        55
Mess                               49
Dessert Parlor, Beverage Shop      49
Casual Dining, Microbrewery        47
Beverage Shop, Dessert Parlor      44
Kiosk                              44
Microbrewery, Pub                  42
Quick Bites, Sweet Shop            41
Pub, Cafe                          40
Cafe, Quick Bites                  40
Fine Dining, Bar                   40
Lounge, Casual Dining              37
Club                               37
Lounge, Bar                        36
Quick Bites, Bakery                35
Food Court, Quick Bites            34
Quick Bites, Beverage Shop         31
Microbrewery                       28
Pub, Bar                           28
Name: rest_type, dtype: int64
In [128]:
# Create Graph with top 20 restaurant type 
#Casual Dining, Quick Bites and Cafe are the 3 most common types of Restaurants
In [129]:
plt.figure(figsize=(15,7))
rest=df['rest_type'].value_counts()[:20]
sns.barplot(rest,rest.index)
plt.title("Restaurant types")
plt.xlabel("count")
plt.show()
In [130]:
# Famous Restaurants 
In [131]:
plt.figure(figsize=(15,7))
chains=df['name'].value_counts()[:20]
sns.barplot(x=chains,y=chains.index,palette='Set1')
plt.title("Most famous restaurant chains",size=20,pad=20)
plt.xlabel("Number of outlets",size=15)
plt.show()
In [132]:
# Model Creation
# Display top 5 records 
In [134]:
display(df.head())
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800.0 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800.0 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300.0 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600.0 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
In [135]:
# Convert the online categorical variables into a numeric format
In [136]:
df.online_order[df.online_order == 'Yes'] = 1 
df.online_order[df.online_order == 'No'] = 0
In [137]:
# Display number of records in each category
In [138]:
df.online_order.value_counts()
Out[138]:
1    16378
0     6870
Name: online_order, dtype: int64
In [139]:
# Change the data type to Number, display top 20 records 
In [140]:
df.online_order = pd.to_numeric(df.online_order)
display (df.head(20))
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa 1 Yes 4.1 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800.0 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant 1 No 4.1 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800.0 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe 1 No 3.8 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana 0 No 3.7 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300.0 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village 0 No 3.8 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600.0 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
5 37, 5-1, 4th Floor, Bosco Court, Gandhi Bazaar... Timepass Dinner 1 No 3.8 286 Basavanagudi Casual Dining Onion Rings, Pasta, Kadhai Paneer, Salads, Sal... North Indian 600.0 [('Rated 3.0', 'RATED\n Food 3/5\nAmbience 3/... [] Buffet Banashankari
6 2469, 3rd Floor, 24th Cross, Opposite BDA Comp... Onesta 1 Yes 4.6 2556 Banashankari Casual Dining, Cafe Farmhouse Pizza, Chocolate Banana, Virgin Moji... Pizza, Cafe, Italian 600.0 [('Rated 5.0', 'RATED\n I personally really l... [] Cafes Banashankari
7 1, 30th Main Road, 3rd Stage, Banashankari, Ba... Penthouse Cafe 1 No 4.0 324 Banashankari Cafe Pizza, Mocktails, Coffee, Nachos, Salad, Pasta... Cafe, Italian, Continental 700.0 [('Rated 3.0', "RATED\n I had been to this pl... [] Cafes Banashankari
8 2470, 21 Main Road, 25th Cross, Banashankari, ... Smacznego 1 No 4.2 504 Banashankari Cafe Waffles, Pasta, Coleslaw Sandwich, Choco Waffl... Cafe, Mexican, Italian, Momos, Beverages 550.0 [('Rated 4.0', "RATED\n Easy to locate\nVFM 3... [] Cafes Banashankari
9 12,29 Near PES University Back Gate, D'Souza N... Café Down The A... 1 No 4.1 402 Banashankari Cafe Waffles, Pasta, Crispy Chicken, Honey Chilli C... Cafe 500.0 [('Rated 4.0', 'RATED\n We ended up here on a... [] Cafes Banashankari
10 941, 3rd FLOOR, 21st Main, 22nd Cross, Banasha... Cafe Shuffle 1 Yes 4.2 150 Banashankari Cafe Mocktails, Peri Fries, Lasagne, Pizza, Chicken... Cafe, Italian, Continental 600.0 [('Rated 1.0', "RATED\n \n\nHorrible. Not even... [] Cafes Banashankari
11 6th Block, 3rd Stage, Banashankari, Bangalore The Coffee Shack 1 Yes 4.2 164 Banashankari Cafe Coffee, Spaghetti, Pancakes, Nachos, Pasta, Sa... Cafe, Chinese, Continental, Italian 500.0 [('Rated 4.0', "RATED\n Food - 4/5\nAmbience ... [] Cafes Banashankari
12 111, Sapphire Toys Building, 100 Feet Ring Roa... Caf-Eleven 0 No 4.0 424 Banashankari Cafe Sandwich, Omelette, Ice Tea, Virgin Mojito, Ho... Cafe, Continental 450.0 [('Rated 2.0', "RATED\n This is a hookah cafe... [] Cafes Banashankari
13 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe 1 No 3.8 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Cafes Banashankari
14 2303, 21st Cross, K R Road, 2nd Stage, Banasha... Cafe Vivacity 1 No 3.8 90 Banashankari Cafe Garlic Bread, Burgers, Sandwiches, Pizza, Hot ... Cafe 650.0 [('Rated 2.0', 'RATED\n Not so good place as ... [] Cafes Banashankari
15 241, 4th Floor, 100 Feet Ring Road, Opposite K... Catch-up-ino 1 No 3.9 133 Banashankari Cafe Momos, Mushroom Bruschettas, Jalapeno Cheeseba... Cafe, Fast Food, Continental, Chinese, Momos 800.0 [('Rated 1.0', "RATED\n This place is right o... [] Cafes Banashankari
16 405, 24th Cross, 9th Main, 2nd Stage, Banashan... Kirthi's Biryani 1 No 3.8 144 Banashankari Cafe Pasta, Gelato, Garlic Bread, Mojito, Nachos, P... Chinese, Cafe, Italian 700.0 [('Rated 3.0', "RATED\n New place.. though it... [] Cafes Banashankari
17 504, CJ Venkata Das Road, Padmanabhangar, 2nd ... T3H Cafe 0 No 3.9 93 Banashankari Cafe Cheese Maggi, Peri Peri Fries, Pasta Arrabiata Cafe, Italian, American 300.0 [('Rated 4.0', "RATED\n Happy to see such a c... [] Cafes Banashankari
18 146, 50 ft Road, 3rd Phase, 3rd Stage, Near Ka... The Vintage Cafe 1 No 3.0 62 Banashankari Cafe Burgers, Caramel Milkshake, Iced Coffee, Iced Tea Cafe, French, North Indian 400.0 [('Rated 2.0', "RATED\n This is a tiny cafÃ\... [] Cafes Banashankari
19 3353, 2nd Cross, Opposite Auden School, Hosker... Woodee Pizza 1 No 3.7 180 Banashankari Cafe Pizza, Garlic Bread Cafe, Pizza, Fast Food, Beverages 500.0 [('Rated 3.0', 'RATED\n Decided to take a bre... [] Cafes Banashankari
In [141]:
# Update Column book_table to 1 and 0 
#change the string categorical into to a categorical int
In [142]:
df.book_table[df.book_table == 'Yes'] = 1 
df.book_table[df.book_table == 'No'] = 0
In [143]:
# Change the data type
In [144]:
df.book_table = pd.to_numeric(df.book_table)
In [145]:
# df.book_table = pd.to_numeric(df.book_table)
In [146]:
display(df.book_table.value_counts())
0    17191
1     6057
Name: book_table, dtype: int64
In [147]:
# Label Encoding of required column
#Label encode the categorical variables to make it easier to build algorithm
In [148]:
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
df.location = le.fit_transform(df.location)
df.rest_type = le.fit_transform(df.rest_type)
df.cuisines = le.fit_transform(df.cuisines)
df.menu_item = le.fit_transform(df.menu_item)
In [149]:
# Get the required columns to create model 
In [150]:
my_data=df.iloc[:,[2,3,4,5,6,7,9,10,12]]
my_data.to_csv('Zomato_df.csv')
display (my_data)
online_order book_table rate votes location rest_type cuisines cost menu_item
0 1 1 4.1 775 1 20 1386 800.0 5047
1 1 0 4.1 787 1 20 594 800.0 5047
2 1 0 3.8 918 1 16 484 800.0 5047
3 0 0 3.7 88 1 62 1587 300.0 5047
4 0 0 3.8 166 4 20 1406 600.0 5047
... ... ... ... ... ... ... ... ... ...
23243 1 1 3.8 128 84 5 1318 1200.0 5047
23244 0 0 3.9 77 84 38 878 2000.0 5047
23245 0 0 2.8 161 84 21 539 1200.0 5047
23246 0 0 2.5 81 84 21 80 800.0 5047
23247 0 1 4.3 236 25 4 878 2500.0 5047

23248 rows × 9 columns

In [151]:
# Create independent Variable 
In [152]:
x = df.iloc[:,[2,3,5,6,7,9,10,12]]
x.head()
Out[152]:
online_order book_table votes location rest_type cuisines cost menu_item
0 1 1 775 1 20 1386 800.0 5047
1 1 0 787 1 20 594 800.0 5047
2 1 0 918 1 16 484 800.0 5047
3 0 0 88 1 62 1587 300.0 5047
4 0 0 166 4 20 1406 600.0 5047
In [153]:
# Create Dependent Variable 
In [154]:
y = df['rate']
display(y)
0        4.1
1        4.1
2        3.8
3        3.7
4        3.8
        ... 
23243    3.8
23244    3.9
23245    2.8
23246    2.5
23247    4.3
Name: rate, Length: 23248, dtype: float64
In [155]:
# Train Test Split
In [156]:
x_train, x_test,y_train,y_test=train_test_split(x,y,test_size=.3,random_state=10)
In [157]:
# Create Linear Regression Model
In [167]:
lr_model=LinearRegression()
lr_model.fit(x_train,y_train)
Out[167]:
LinearRegression()
In [168]:
# Prediction and display Accuracy 
In [169]:
from sklearn.metrics import r2_score
y_pred=lr_model.predict(x_test)
display (r2_score(y_test,y_pred))
0.22818828522967471
In [170]:
# Random Forest Regressor
In [171]:
from sklearn.ensemble import RandomForestRegressor
RF_Model=RandomForestRegressor(n_estimators=650,random_state=245,min_samples_leaf=.0001)
RF_Model.fit(x_train,y_train)
y_predict=RF_Model.predict(x_test)
display (r2_score(y_test,y_predict))
0.8809706960047533
In [172]:
# Preparing Extra Tree Regression
In [173]:
from sklearn.ensemble import  ExtraTreesRegressor
ET_Model=ExtraTreesRegressor(n_estimators = 120)
ET_Model.fit(x_train,y_train)
y_predict=ET_Model.predict(x_test)
In [174]:
# Display Accuracy
In [175]:
from sklearn.metrics import r2_score
display(r2_score(y_test,y_predict))
0.932724849640803
In [176]:
# Generate Pickle File 
In [177]:
import pickle 
# Saving model to disk
pickle.dump(ET_Model, open('model.pkl','wb'))
model=pickle.load(open('model.pkl','rb'))
In [ ]: